home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / questRomance5.lua < prev    next >
Text File  |  2004-01-29  |  2KB  |  74 lines

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questRomance5 entered");
  6.         setState("initial");
  7.     end )
  8.     
  9.     -- on game over: relationship conditions get reset to 0 and all quests are reset to initial
  10.     onMsg("questreset", function(msg)
  11.         setState("initial");
  12.     end ) 
  13. ---------------------------------------------------------------------------------------------------------------------------------------    
  14.     
  15.     state("initial") 
  16.         onMsg("checkCondition", function(msg)
  17.             local mike = getParent().getParent().getCharacter(MIKE);
  18.             local elaine = getParent().getParent().getCharacter(ELAINE);
  19.  
  20.             if ( -- condition here
  21.         ----------------
  22.                 min(    mike.getRelationshipCondition(ELAINE, REL_ROMANCE),
  23.                     elaine.getRelationshipCondition(MIKE, REL_ROMANCE)) >= 5)
  24.         ----------------
  25.             then
  26.                 -- popup candle light dinner chapter
  27.                 popupChapter("guiStoryChapterGroup1");
  28.  
  29.                 setDelayedState("talktome", 10);
  30.             end
  31.         end )
  32.         
  33.         
  34.     state("talktome")
  35.         onEnter(function(msg)
  36.             local mike = getParent().getParent().getCharacter(MIKE);
  37.             local elaine = getParent().getParent().getCharacter(ELAINE);
  38.  
  39.             -- go to talk position
  40.             elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "questRomance5");
  41.         end )
  42.         
  43.         -- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
  44.         onMsg("talking", function(msg)
  45.             if ( msg.data == "questRomance5" ) then 
  46.                 popupConversation("dialogRomance5");
  47.                 setState("donetalktome");
  48.             end 
  49.         end )
  50.         
  51.     state("donetalktome");
  52.         -- last dialog box clicked away
  53.         onMsg("yes", function(msg)
  54. --print("*** questRomance5 - talktome yes ***");
  55.             -- cancel
  56.             local mike = getParent().getParent().getCharacter(MIKE);
  57.             local elaine = getParent().getParent().getCharacter(ELAINE);
  58.  
  59.             mike.cancelCurrentActivity();
  60.             elaine.cancelCurrentActivity();
  61.             setState("done");
  62.         end )
  63.  
  64. ---------------------------------------------------------------------------------------------------------------------------------------    
  65.  
  66.         
  67.     state("done")
  68.     
  69.     -- sackgasse hier
  70.         
  71.         
  72.         
  73. endStateMachine()
  74.